﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AgileFx.ORM.Backends.LinqToSql;
using AgileFx.ORM;
using AgileFx.ORM.Materialization;
using System.Linq.Expressions;

namespace AgileFx.MVC.PerformanceTools.LinqToSql
{
    public abstract class TracingDataContext : L2SDataContext
    {
        public TracingDataContext() : base()
        {

        }

        public override void AddObject(IEntity entity)
        {
            base.AddObject(entity);
        }

        public override void DeleteObject(IEntity entity)
        {
            base.DeleteObject(entity);
        }

        public override void AttachObject(IEntity entity)
        {
            base.AttachObject(entity);
        }

        public override IEntityQuery<T> CreateQuery<T>()
        {
            return base.CreateQuery<T>();
        }

        public override void SaveChanges()
        {
            base.SaveChanges();
        }

        protected override AgileFx.ORM.EntityQueryProvider GetQueryProvider()
        {
            return new TracingQueryProvider(this);
        }

        public override ResultListMaterializer<T> GetResultListMaterializer<T>()
        {
            return new TracingResultListMaterializer<T>(_InternalServices.GetEffectiveContext());
        }

        public override SingleObjectMaterializer<T> GetSingleObjectMaterializer<T>()
        {
            return new TracingSingleObjectMaterializer<T>(_InternalServices.GetEffectiveContext());
        }
    }
}
